home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / util / moni / Scout-src.lha / source / objects / scout_about.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-09-17  |  3.6 KB  |  116 lines

  1. /**
  2.  * Scout - The Amiga System Monitor
  3.  *
  4.  *------------------------------------------------------------------
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; either version 2 of the License, or
  9.  * any later version.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program; if not, write to the Free Software
  18.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  *
  20.  * You must not use this source code to gain profit of any kind!
  21.  *
  22.  *------------------------------------------------------------------
  23.  *
  24.  * @author Andreas Gelhausen
  25.  * @author Richard Körber <rkoerber@gmx.de>
  26.  */
  27.  
  28. #include "system_headers.h"
  29.  
  30. static ULONG __saveds mNew( struct IClass *cl,
  31.                             Object *obj,
  32.                             struct opSet *msg )
  33. {
  34.     APTR abouttext,okButton;
  35.  
  36.     if (obj = (Object *)DoSuperNew(cl, obj,
  37.         MUIA_Window_Title, "About Scout",
  38.         WindowContents, VGroup,
  39.  
  40.             Child, abouttext = MyTextObject(),
  41.             Child, MyVSpace(4),
  42.             Child, HGroup, MUIA_Group_SameWidth, TRUE,
  43.                 Child, MyHSpace(0),
  44.                 Child, okButton = MakeButton(txtMUIContinue),
  45.                 Child, MyHSpace(0),
  46.             End,
  47.         End,
  48.         TAG_MORE, msg->ops_AttrList))
  49.     {
  50.         set(obj, MUIA_Window_ActiveObject, okButton);
  51.         MySetContents(abouttext, txtAboutText, vstring, release, COPYRIGHT, EMAIL, portname);
  52.  
  53.         DoMethod(obj,      MUIM_Notify, MUIA_Window_CloseRequest, TRUE,  MUIV_Notify_Application, 2, MUIM_Application_ReturnID, 1);
  54.         DoMethod(okButton, MUIM_Notify, MUIA_Pressed,             FALSE, MUIV_Notify_Application, 2, MUIM_Application_ReturnID, 1);
  55.     }
  56.  
  57.     return (ULONG)obj;
  58. }
  59.  
  60. static ULONG __saveds mDispose( struct IClass *cl,
  61.                                 Object *obj,
  62.                                 struct opSet *msg )
  63. {
  64.     set(obj, MUIA_Window_Open, FALSE);
  65.  
  66.     return (DoSuperMethodA(cl, obj, msg));
  67. }
  68.  
  69. static ULONG __saveds mAbout( struct IClass *cl,
  70.                               Object *obj,
  71.                               Msg msg )
  72. {
  73.     APTR app;
  74.     BOOL done = FALSE;
  75.     ULONG result = 0;
  76.  
  77.     get(obj, MUIA_ApplicationObject, &app);
  78.     set(app, MUIA_Application_Sleep, TRUE);
  79.     set(obj, MUIA_Window_Open, TRUE);
  80.  
  81.     while (!done) {
  82.         ULONG signals;
  83.  
  84.         switch (DoMethod(app, MUIM_Application_NewInput, &signals)) {
  85.             case MUIV_Application_ReturnID_Quit:
  86.             case 1:
  87.                 done = TRUE;
  88.                 break;
  89.  
  90.             default:
  91.                 break;
  92.         }
  93.  
  94.         if (!done && signals != 0) Wait(signals);
  95.     }
  96.  
  97.     set(obj, MUIA_Window_Open, FALSE);
  98.     set(app, MUIA_Application_Sleep, FALSE);
  99.  
  100.     return result;
  101. }
  102.  
  103. ULONG __asm __saveds AboutWinDispatcher( register __a0 struct IClass *cl,
  104.                                          register __a2 Object *obj,
  105.                                          register __a1 Msg msg )
  106. {
  107.     switch (msg->MethodID) {
  108.         case OM_NEW:              return (mNew(cl, obj, (APTR)msg));
  109.         case OM_DISPOSE:          return (mDispose(cl, obj, (APTR)msg));
  110.         case MUIM_AboutWin_About: return (mAbout(cl, obj, (APTR)msg));
  111.     }
  112.  
  113.     return (DoSuperMethodA(cl, obj, msg));
  114. }
  115.  
  116.